cordova.define("com.ruaho.plugin", function(require, exports, module) {
	var argscheck = require('cordova/argscheck');
	var exec = require("cordova/exec");
	var rh = function() {};

	var RuahoPluginError = function(code, message) {
		this.code = code || null;
		this.message = message || '';
	};

	RuahoPluginError.NO_PROPERTY = 0;
	RuahoPluginError.NO_PREFERENCE_ACTIVITY = 1;


	var RuahoPlugin = function() {};

	RuahoPlugin.get = function(key, success, fail) {
		exec(success, fail, "RuahoPlugin", "get", [key]);
	};

	RuahoPlugin.set = function(key, value, success, fail) {
		exec(success, fail, "RuahoPlugin", "set", [key, value]);
	};

	RuahoPlugin.invokeNative = function(key,value,success,fail) {
    	exec(success,fail,"RuahoPlugin","invokeNative",[key, value]);
	};
	
  	RuahoPlugin.saveData = function(table, paramObj,success,fail) {
     	exec(success,fail,"RuahoPlugin","saveData",[table, paramObj]);
  	};

  	RuahoPlugin.batchSave = function(table, paramObj,success,fail) {
    	exec(success,fail,"RuahoPlugin","saveDataArray",[table, paramObj]);
  	};

  	RuahoPlugin.getData = function(table, paramObj ,success,fail) {
    	exec(success,fail,"RuahoPlugin","getData",[table, paramObj]);
  	};

  	RuahoPlugin.getDataCount = function(table, paramObj,success,fail) {
	    exec(success,fail,"RuahoPlugin","getDataCount",[table, paramObj]);
  	};

  	RuahoPlugin.removeData = function(table, paramObj,success,fail) {
    	exec(success,fail,"RuahoPlugin","removeData",[table, paramObj]);
  	};

   	// 语音播放
  	RuahoPlugin.playVoice = function(paramObj,success,fail) {
    	exec(success,fail,"RuahoPlugin","playVoice",[paramObj]);
  	};
	
  	RuahoPlugin.pauseVoice = function(paramObj,success,fail) {
    	exec(success,fail,"RuahoPlugin","pauseVoice",[paramObj]);
  	};
	
  	RuahoPlugin.stopVoice = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","stopVoice",[paramObj]);
  	};

  	//开始录音
  	RuahoPlugin.startRecord = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","startRecord",[paramObj]);
  	};
  	//停止录音
  	RuahoPlugin.stopRecord = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","stopRecord",[paramObj]);
  	};
  	//录音自动结束接口
  	RuahoPlugin.onVoiceRecordEnd = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","onVoiceRecordEnd",[paramObj]);
  	};
  	//监听语音播放完
  	RuahoPlugin.onVoicePlayEnd = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","onVoicePlayEnd",[paramObj]);
  	};
  	//上传语音
  	RuahoPlugin.uploadVoice = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","uploadVoice",[paramObj]);
  	};
  	//下载语音
  	RuahoPlugin.downloadVoice = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","downloadVoice",[paramObj]);
  	};
  	
  	//显示网络状态
  	RuahoPlugin.getNetworkType = function(paramObj, success,fail) {
    	exec(success,fail,"RuahoPlugin","getNetworkType",[paramObj]);
  	};

	RuahoPlugin.clearRedFlag = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "clearRedFlag", [paramObj]);
	};

	RuahoPlugin.addRedFlag = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "addRedFlag", [paramObj]);
	};

	RuahoPlugin.startUserChat = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "startUserChat", [paramObj]);
	};

	RuahoPlugin.startGroupChat = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "startGroupChat", [paramObj]);
	};

	RuahoPlugin.getServer = function(paramObj, success, error) {
    	exec(success, error, "RuahoPlugin", "getServer", [{}]);
  	};

  	RuahoPlugin.getUuid = function(paramObj, success, error) {
    	exec(success, error, "RuahoPlugin", "getUuid", [{}]);
  	}

  	RuahoPlugin.getUserInfo = function(paramObj, success, error) {
    	exec(success, error, "RuahoPlugin", "getUserInfo", [{}]);
  	};

  	RuahoPlugin.getToken = function(paramObj, success, error) {
    	exec(success, error, "RuahoPlugin", "getToken", [{}]);
  	};

  	RuahoPlugin.showOrgAddressSection = function(paramObj, success, error) {
    	exec(success, error, "RuahoPlugin", "showOrgAddressSection", [{}]);
  	};
  	RuahoPlugin.displayFlowSetting = function(paramObj, success, error) {
     	exec(success, error, "RuahoPlugin", "displayFlowSetting", [paramObj]);
    };

	/**
	 * 日期控件
	 */
	RuahoPlugin.datepicker = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "datepicker", [paramObj]);
	};
	
	/**
	 * 标题栏：菜单插件（右上角渲染）
	 */
	RuahoPlugin.setRightTopMenu = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "setRightTopMenu", [paramObj]);
	};
	
	/**
	 * 标题栏：菜单插件（底部渲染）
	 */
	RuahoPlugin.setBottomMenu = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "setBottomMenu", [paramObj]);
	};

    /**
     * 直接弹出底部菜单
     */
	RuahoPlugin.showBottomMenu = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "showBottomMenu", [paramObj]);
    };

    /**
	 * 弹出选择菜单
	 */
	RuahoPlugin.showActionSheet = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showActionSheet", [paramObj]);
	};

	/**
	 * 意见列表
	 */
	RuahoPlugin.showMindList = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showMindList", [paramObj]);
	};

	/**
	 * 流程跟踪
	 */
	RuahoPlugin.showFlowTrack = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showFlowTrack", [paramObj]);
	};

	/**
	 * 收藏
	 */
	RuahoPlugin.doStore = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "doStore", [paramObj]);
	};

	/**
	 * 下载文件
	 */
	RuahoPlugin.downloadFile = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "downloadFile", [paramObj]);
	};

	/**
	 * 显示选人界面
	 */
	RuahoPlugin.showOrgAddressSection = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showOrgAddressSection", [paramObj]);
	};

	/**
	 * 获取头像
	 */
	RuahoPlugin.getUserIconUrl = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "getUserIconUrl", [paramObj]);
	};

	/**
	 * 保存上个页面是否需要刷新标识
	 */
	RuahoPlugin.saveRefreshIdentifier = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "saveRefreshIdentifier", [paramObj]);
	};

	/**
	 * webView当前页面更换标题
	 */
	RuahoPlugin.modifyWebViewTitle = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "modifyWebViewTitle", [paramObj]);
	};

	/**
	 * 流程转发到聊天
	 */
	RuahoPlugin.doTranmit = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "doTranmit", [paramObj]);
	};

	/**
	 * 隐藏webView右上角按钮
	 */
	RuahoPlugin.hideRightBarButtonItem = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "hideRightBarButtonItem", [paramObj]);
	};

	/**
	 * 意见插件
	 */
	RuahoPlugin.displayMindInputDialog = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "displayMindInputDialog", [paramObj]);
	};

	/**
	 * 流程跟踪插件
	 */
	RuahoPlugin.displayWorkFlowHistory = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "displayWorkFlowHistory", [paramObj]);
	};
	
	/**
	 * 土司提醒
	 */
	RuahoPlugin.displayToast = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "displayToast", [paramObj]);
	};

	RuahoPlugin.closeWindow = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "closeWindow", [paramObj]);
	};
	
	RuahoPlugin.previewImage = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "previewImage", [paramObj]);
	};
	
	RuahoPlugin.chooseImage = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "chooseImage", [paramObj]);
	};
	
	RuahoPlugin.uploadImage = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "uploadImage", [paramObj]);
	};

	RuahoPlugin.downloadImage = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "downloadImage", [paramObj]);
	};
	
	RuahoPlugin.openLocation = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "openLocation", [paramObj]);
	};
	
	RuahoPlugin.getLocation = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "getLocation", [paramObj]);
	};
	
	RuahoPlugin.scanQRCode = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "scanQRCode", [paramObj]);
	};
	
	RuahoPlugin.saveServDef = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "saveServDef", [paramObj]);
	};
	
	RuahoPlugin.getServDefValue = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "getServDefValue", [paramObj]);
	};
	
	RuahoPlugin.getServDefDigest = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "getServDefDigest", [paramObj]);
	};
	
	RuahoPlugin.getDictTree = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "getDictTree", [paramObj]);
	};
	
	RuahoPlugin.group_create = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "group_create", [paramObj]);
	};
	
	RuahoPlugin.group_addUsers = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "group_addUsers", [paramObj]);
	};
	
	RuahoPlugin.group_removeUsers = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "group_removeUsers", [paramObj]);
	};
	
	RuahoPlugin.group_setAdmins = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "group_setAdmins", [paramObj]);
	};
	
	RuahoPlugin.group_del = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "group_del", [paramObj]);
	};
	
	RuahoPlugin.displayLoading = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "displayLoading", [paramObj]);
	};
	
	RuahoPlugin.hideLoading = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "hideLoading", [paramObj]);
	};
	
	RuahoPlugin.openFile = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "openFile", [paramObj]);
	};

	RuahoPlugin.selectUser = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "selectUser", [paramObj]);
	};

	/**
     * 隐藏右上角菜单
     */
    RuahoPlugin.hideOptionMenu = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "hideOptionMenu", []);
    };
    
    /**
     * 显示右上角菜单
     */
    RuahoPlugin.showOptionMenu = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "showOptionMenu", []);
    };
    
    /**
     * 批量隐藏功能按钮
     */
    RuahoPlugin.hideMenuItems = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "hideMenuItems", [paramObj]);
    };
    
    /**
     * 批量显示功能按钮
     */
    RuahoPlugin.showMenuItems = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "showMenuItems", [paramObj]);
    };
    
    /**
     * 隐藏所有非基础按钮
     */
    RuahoPlugin.hideAllNonBaseMenuItem = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "hideAllNonBaseMenuItem", []);
    };
    
    /**
     * 显示所有功能按钮
     */
    RuahoPlugin.showAllNonBaseMenuItem = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "showAllNonBaseMenuItem", []);
    };

	/**
	 * 点击列表上的待办条目，进入审批单办理界面。审批单办理完毕之后，调用JS方法通知列表界面，删掉待办。
	 */
    RuahoPlugin.removePrePageItem = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "removePrePageItem", []);
    };
	
	RuahoPlugin.setReturnBtnEvent = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "setReturnBtnEvent", [paramObj]);
	};
	
	RuahoPlugin.displayDSMFile = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "displayDSMFile", [paramObj]);
	};
	
	RuahoPlugin.createNav = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "createNav", [paramObj]);
	};

	RuahoPlugin.createActionList = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "fetchAction", [paramObj]);
	};

	RuahoPlugin.createUserList = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "fetchUser", [paramObj]);
	};

	RuahoPlugin.showConfirm = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showConfirm", [paramObj]);
	};

	RuahoPlugin.hideHud = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "hideHud", [paramObj]);
	};

	RuahoPlugin.popWindow = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "popWindow", [paramObj]);
	};
	
	RuahoPlugin.checkDependentVer = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "checkDependentVer", [paramObj]);
	};

	RuahoPlugin.canOpenURL = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "canOpenURL", [paramObj]);
	};
	
	RuahoPlugin.openURL = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "openURL", [paramObj]);
	};

	RuahoPlugin.enableRightBarButtonItem = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "enableRightBarButtonItem", [paramObj]);
	};

	RuahoPlugin.showUserDetail = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showUserDetail", [paramObj]);
	};

	RuahoPlugin.showAppDetail = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showAppDetail", [paramObj]);
	};

	RuahoPlugin.isFullScreen = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "isFullScreen", [paramObj]);
	};

	RuahoPlugin.showFlowChart = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showFlowChart", [paramObj]);
	};

	RuahoPlugin.doSendUrge = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "doSendUrge", [paramObj]);
	};
	
	RuahoPlugin.goNextTodo = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "goNextTodo", [paramObj]);
	};
  
  RuahoPlugin.setEnableBackCheck = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "setEnableBackCheck", [paramObj]);
  };

  RuahoPlugin.showAlertMessage = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "showAlertMessage", [paramObj]);
  };

  RuahoPlugin.getClipboardContent = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "getClipboardContent", [paramObj]);
  };

  RuahoPlugin.openWebview = function(paramObj, success, error) {
		exec(success, error, "RuahoPlugin", "openWebview", [paramObj]);
  };

  RuahoPlugin.playVideo = function(paramObj, success, error) {
        exec(success, error, "RuahoPlugin", "playVideo", [paramObj]);
  };
  RuahoPlugin.back = function(paramObj, success, error) {
    exec(success, error, "RuahoPlugin", "back", [paramObj]);
  };

	module.exports = RuahoPlugin;
});

if (!window.rh) {
	window.rh = cordova.require("com.ruaho.plugin");
	window.rh.cochat_client = true;
}
if (!window.$RuahoPlugin) { // window.rh太简单很容易被覆盖
	window.$RuahoPlugin = cordova.require("com.ruaho.plugin");
	window.$RuahoPlugin.cochat_client = true;
}